package ae.pcfc.etks.online.common.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Process entity. @author Mohtisham.Salahria
 */
@Entity
@Table(name = "T_ETKS_PROCESS", schema = "ETKS_ONLINE_DBA")
@SequenceGenerator(name = "SQ_ETKS_PROCESS", sequenceName = "SQ_ETKS_PROCESS", initialValue = 1, allocationSize = 1)
public class Process implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	// Fields
	private String processCode;
	private String processDesc;
	private String processDescA;
	private String processStatus;
	
	private Set<ProcessStep> ProcessSteps = new HashSet<ProcessStep>(
			0);
	private Set<AppMetaData> AppMetaDatas = new HashSet<AppMetaData>(
			0);

	// Constructors

	/** default constructor */
	public Process() {
	}

	/** minimal constructor */
	public Process(String processCode, String processStatus) {
		this.processStatus = processStatus;
		this.processCode = processCode;
	}

	/** full constructor */
	public Process(String processDesc, String processDescA,
			String processStatus, Set<AppMetaData> AppMetaDatas) {
		this.processDesc = processDesc;
		this.processDescA = processDescA;
		this.processStatus = processStatus;		
		this.AppMetaDatas = AppMetaDatas;
	}

	// Property accessors
	@Id
	@Column(name = "PROCESS_CODE", unique = true, nullable = false, length = 10)
	public String getProcessCode() {
		return this.processCode;
	}

	public void setProcessCode(String processCode) {
		this.processCode = processCode;
	}

	@Column(name = "PROCESS_DESC", length = 80)
	public String getProcessDesc() {
		return this.processDesc;
	}

	public void setProcessDesc(String processDesc) {
		this.processDesc = processDesc;
	}

	@Column(name = "PROCESS_DESC_A", length = 80)
	public String getProcessDescA() {
		return this.processDescA;
	}

	public void setProcessDescA(String processDescA) {
		this.processDescA = processDescA;
	}

	@Column(name = "PROCESS_STATUS", nullable = false, length = 4)
	public String getProcessStatus() {
		return this.processStatus;
	}

	public void setProcessStatus(String processStatus) {
		this.processStatus = processStatus;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "process")
	public Set<ProcessStep> getProcessSteps() {
		return this.ProcessSteps;
	}

	public void setProcessSteps(Set<ProcessStep> ProcessSteps) {
		this.ProcessSteps = ProcessSteps;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "process")
	public Set<AppMetaData> getAppMetaDatas() {
		return this.AppMetaDatas;
	}

	public void setAppMetaDatas(Set<AppMetaData> AppMetaDatas) {
		this.AppMetaDatas = AppMetaDatas;
	}

}